package com.ecoolex.ying.space.enums;

import com.ecoolex.framework.common.EnumInterface;
import com.ecoolex.framework.common.util.Check;
import com.ecoolex.ying.space.entity.EstateProjectActivityCouponOrder;

public enum EstateProjectActivityCouponOrderStatus implements EnumInterface<EstateProjectActivityCouponOrderStatus, Integer>{

	UNPAID(1, "待支付"),
	PAID(2,"已支付"),
    CANCEL(3, "取消"),
    REFUND(4, "已退款");
    

	private int real;

	private String describe;

	private EstateProjectActivityCouponOrderStatus(int real, String describe) {
		this.real = real;
		this.describe = describe;
	}

	@Override
	public Integer real() {
		return real;
	}

	@Override
	public String describe() {
		return describe;
	}

	@Override
	public EstateProjectActivityCouponOrderStatus realOf(Integer real) {
		if (Check.notNull(real)) {
			for (EstateProjectActivityCouponOrderStatus v : values()) {
				if (v.real().equals(real)) {
					return v;
				}
			}
		}
		return null;
	}
	
	public static boolean canPay(EstateProjectActivityCouponOrder order) {
		return UNPAID.equal(order.getStatus());
	}
	
	public static boolean canRefund(EstateProjectActivityCouponOrder order) {
		return PAID.equal(order.getStatus());
	}
}
